Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using delegate instead fixed function #31

Closed

Conversation

yvoinov
Copy link

@yvoinov yvoinov commented Jun 12, 2020

No description provided.

Spin lock replaced/affinity support added. Also size_t replaced to std::size_t. :)
Replaced post-increment in affinity code to pre-increment.
Make affinity controllable by boolean flag. On supported platforms affinity will always build, to turn it on in application just enough to set tp::v_affinity = true; in application.
Polishing affinity code (one condition less)
FreeBSD affinity support added.
Unnesessary include removed.
We're should bind only online cores.
Fix job stealing. It also should send notification, otherwise steal() can't wake up worker.
Better fix for job stealing.
Changes from inkooboo#24 are incorporated. Conditional variables instead spin-lock are kept as well.
Fix overnotification when tryPost.
Refactoring. Partial rollback  2e5151b.
After profiling and testing, rollback FixedFunction() instead std::function.
A new post() often occurs in imputation of the sleep sequence. Interrupting the sequence here and performing pop() allows to somewhat reduce pool latency.
A new post() often occurs during a sleep sequence. Interrupting the sequence and performing pop() allows you to somewhat reduce pool latency.
Oracle Developer Studio cannot compile fixed_function.hpp. So, to build pool with this compiler, we're just use std::function instead fixed function implementation.
Logical error in threadFunc() fixed; other minor fixes.
Some refactoring affinity code
Sleep counter implementation
Rework ThreadPoolImpl<Task, Queue>::post(Handler&& handler) to prevent accidentally exception when thread pool falsely full.
Note: std::exchange is C++14
Performance improvement. This micro optimization reduce latency with job stealing up to 1-2 ms.
SLEEP_CNT renamed to IDLE_CNT; made fully C++11 compatible
Less unnesessary code generation
- Using CV wait_for in post() instead sleep_for
- Fix post() description
- Requires more strict barriers in MPMC to prevent hangs
- Vector include moved to appropriate place
Queue-overflow proofed post() implemented for thread pool.
Removed unnesessary lambda.
Avoid warning 'Unused variable w'
It is non-requires to SunPRO conditional compilation for compatibility
@yvoinov yvoinov closed this Jun 12, 2020
@yvoinov yvoinov deleted the using-delegate-instead-fixed-function branch June 12, 2020 16:19
@yvoinov
Copy link
Author

yvoinov commented Jun 12, 2020

Sorry, wrong click made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant